clear all
set more off
capture log close

* cd
global mainpath "~/Dropbox"
cd $mainpath

* paths

global path_cclpg_data "CCLPG/CCLPG_paper/Data"

set scheme s1mono

use ${path_cclpg_data}/hh_roster_endline.dta, clear

forvalues l = 0(1)4 {
	
	local u = `l' + 1
	
	capture drop age_`l'_`u'
	capture drop N_`l'_`u'
	
	gen age_`l'_`u' = (hh_member_age_ > `l' & hh_member_age_ <= `u') if hh_member_age_ != .	
	bys hh_code_correct: egen N_`l'_`u' = total(age_`l'_`u')
	
	sum  N_`l'_`u' if hh_member == 1 [iweight = pweight_e]
}

 